package com.xiaolun.other;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class Demo06 {
	public static void main(String[] args) {
		fileWriterDemo();
	}

	private static void fileWriterDemo() {
		String separator = File.separator;
		//1、定义要进行磁盘输出的完整路径
		File file = new File("D:" + separator + "test" + separator + "test3.txt");
		if(file.exists()){
			FileWriter out = null;
			try {
				out = new FileWriter(file);
				out.write("hello,world----> success"); //输出
				out.append("----------success"); //追加
			} catch (IOException e) {
				e.printStackTrace();
			} finally {
				try {
					out.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
